<%@ page contentType="text/html;charset=GBK" %>
<%@ page import="java.util.*" %>
<%@ page import="com.ionglobal.db.*" %>
<%@ page import="com.ionglobal.lib.*" %>
<%@ page import="com.ionglobal.misc.*" %>

<%@ include file="../init_include.jsp" %>

<%
	Integer catId;
	int totalpages,pageid=0;
	int pagerows=Page.getPageRows();
	int totalUsers=0;
	int titleMaxLen=20;
  String ordermode="desc";
  String orderfield="id";
  
	Sysop sysop=(Sysop)session.getAttribute("sysop");	
	int userid = sysop.getId();
	String idtext="",temp="";
	try {
		if (request.getParameter("id")!=null)
			temp=request.getParameter("id");
		if(temp!=null && temp.length()>0) {
			if(temp.indexOf(",")!=-1)
				idtext=temp.substring(0,temp.length()-1);				
			else
				userid=Integer.parseInt(temp);
		}			
		if (request.getParameter("id1")!=null)
			temp=request.getParameter("id1");
		if(temp!=null && temp.length()>0) {
			if(temp.indexOf(",")!=-1)
				idtext=temp.substring(0,temp.length()-1);				
			else
				userid=Integer.parseInt(temp);
		}						
	}	catch(Exception e) {
		return ;
	}	
			
	if(request.getParameter("ordermode")!=null)
		ordermode=request.getParameter("ordermode");	
	if(request.getParameter("orderfield")!=null)
		orderfield=request.getParameter("orderfield");		
		
	try {
		if (request.getParameter("pageid")!=null)
			pageid=Integer.parseInt(request.getParameter("pageid"));
		else
			pageid=1;
	}	catch(NumberFormatException e) {
		out.println(e+"pageid");
		pageid=1;
	}	
	
	try {
		if (request.getParameter("pagerows")!=null)
			pagerows=Integer.parseInt(request.getParameter("pagerows"));
	} catch(NumberFormatException e) {
		out.println(e+"pagerows");
	}	

	String whereClause="";
	if(request.getParameter("whereClause")!=null)
		whereClause=request.getParameter("whereClause");	
	whereClause=whereClause.trim();

	totalUsers=SysopDB.getUserNumNotInUser(dbi,userid,whereClause,idtext);
	totalpages = (int)Math.ceil((double)totalUsers/pagerows);
	if(pageid>totalpages)
		pageid=totalpages;
	if(pageid<=1)
		pageid=1;
%>	
<html>
<head>
<title><%=Language.getNameByCode("sys.sysop.manage","User Manage")%></title>
<meta http-equiv="Content-Type" content="text/html; charset=<%=Language.getHTMLLanguageStr()%>">
<link rel="stylesheet" href="../css.css" type="text/css">
<SCRIPT language=JavaScript1.2 src="../script/Ion_Show.js"></SCRIPT>
<script language="javascript">
<!--
	function Ion_Select()
	{
		var str=selectOneIon('vmsSelectFrame.jsp','','<%=Language.getNameByCode("sys.sysop","Sysop")%>');
		if(str!=null) {
		 	var top=this;
			var intPos=str.indexOf("|");
			window.opener.formIon.user.value=str.substring(0,intPos);
 			window.opener.formIon.username.value=str.substring(intPos+1); 	
 			if (parent) top=parent;
			top.close(); 		
		}
	}
	
	function Ion_Search()
	{
		add_Ion('vmsSelectFrame.jsp','../ums/sysop_search.jsp','userid',"search_user");
	}	
-->
</script>
</head>

<body bgColor=#d6d3ce leftMargin=0 
style="BORDER-BOTTOM: 0px outset; BORDER-LEFT: 0px outset; BORDER-RIGHT: 0px outset; BORDER-TOP: 0px outset" 
topMargin=0>

<FORM name="formIon" method="post" action="?">
<table width="100%" border="0" cellspacing="1" cellpadding="2">
 	<tr>
   	<td align="left">
   		<%=Language.getNameByCode("sys.sysop.userlist","Users List")%><%=PageStr.getPageHead(totalUsers,pageid,pagerows,totalpages)%>
    </td>
    <td align=right>
			<%=PageStr.PageForm(pageid,totalpages)%><input type="submit" name="Submit" value="go" style="width:0">
    </td>
  </tr>
</table>

	<TABLE border=0 cellPadding=0 cellSpacing=1 height="100%" width="100%">
		<input type="hidden" name="catid" value="0">
		<input type="hidden" name="id" value="<%=(idtext+",")%>">
		<input type="hidden" name="id1" value="<%=userid%>">
		<INPUT name="objid" type="hidden">
		<INPUT name="objtext" type="hidden">
		<INPUT name="objflag" type="hidden">
		<INPUT name="actionurl" type="hidden">
		<input type="hidden" name="whereClause" value="<%=whereClause%>">
		<input type="hidden" name="orderfield" value="<%=orderfield%>">
		<input type="hidden" name="ordermode" value="<%=ordermode%>">
  	<TR>
    <TD>
    <APPLET code=com.ionglobal.gui.Table codeBase=../ height="100%" name=table1 width="100%" VIEWASTEXT mayscript archive="gui.jar">
    <PARAM NAME="columnCount" VALUE="10">    
    <PARAM NAME="header" VALUE="no|<%=Language.getNameByCode("sys.sysop.id","ID")%>|<%=Language.getNameByCode("sys.sysop.name","Name")%>|<%=Language.getNameByCode("sys.sysop.fullname","FullName")%>|<%=Language.getNameByCode("sys.sysop.status","Status")%>|<%=Language.getNameByCode("sys.sysop.depart","Department")%>|<%=Language.getNameByCode("sys.sysop.email","Email")%>|<%=Language.getNameByCode("sys.sysop.logincount","Login Counts")%>|<%=Language.getNameByCode("sys.sysop.lastlogin","Last Date")%>|<%=Language.getNameByCode("sys.sysop.usermanage","user manage privilege")%>">
    <%	
  Vector vc=SysopDB.getAllSysopsWithUserNoInUser(dbi,userid,whereClause,idtext,pageid,pagerows,orderfield,ordermode);
  String statusstr[]=StaticDim.getUserStatus();
	for (int i=0;i<vc.size();i++)
	{	
		Sysop user=(Sysop)vc.get(i);
%>    <PARAM NAME="row_<%=i%>" VALUE="<%=user.getId()%>|<%=user.getId()%>|<%=user.getName()%>|<%=(user.getFullName()+" ")%>|<%=statusstr[user.getStatus()]%><%if(user.getStatus()==1 && user.getExpire()!=null) out.print(user.getExpire());%>|<%=user.getDepartName()%>| <%=user.getEmail()%>|<%=user.getLoginCount()%>|<%=user.getLastLogin()%>|<%=user.getRightFlag()%>">
    <PARAM NAME="cellImage_<%=i%>_1" VALUE="../images/item.gif">
<% }
	int count=0;
%>   
		<PARAM NAME="sortMode" VALUE="<%=ordermode%>">
    <PARAM NAME="sortField" VALUE="<%=orderfield%>">
    <PARAM NAME="sortFieldList" VALUE="id,id,name,fullname,status,departid,email,logincount,lastlogin,rightflag">    
    <PARAM NAME="fieldseparator" VALUE="|">
    <PARAM NAME="urlColor" VALUE="black">
    <PARAM NAME="urlStyle" VALUE="noline">
    <PARAM NAME="menu<%=count%>" VALUE="<%=Language.getNameByCode("sys.sysop.select","Select User")%>">
    <PARAM NAME="menuurl<%=count%>" VALUE="JavaScript:Ion_Select();">
    <%count++;%>    
    <PARAM NAME="menu<%=count%>" VALUE="<%=Language.getNameByCode("sys.sysop.SeeChild","View Sub-User")%>">
    <PARAM NAME="menuurl<%=count%>" VALUE="javascript:changeIon('selectSysop.jsp','<%=Language.getNameByCode("sys.sysop","User")%>',9);">
    <PARAM NAME="separator<%=count%>" VALUE="Y">
    <%count++;%>    
    <PARAM NAME="menu<%=count%>" VALUE="<%=Language.getNameByCode("sys.Head.Refresh","Refresh")%>">
    <PARAM NAME="menuurl<%=count%>" VALUE="javascript:self.location.reload();">
    <PARAM NAME="separator<%=count%>" VALUE="Y">
    <%count++;%>
    <PARAM NAME="menu<%=count%>" VALUE="<%=Language.getNameByCode("sys.sysop.search","Search User")%>">
    <PARAM NAME="menuurl<%=count%>" VALUE="javascript:Ion_Search();">
    <PARAM NAME="urltarget" VALUE="header1">
    <PARAM NAME="alternateRowBackground" VALUE="#D0E8FF">
    <PARAM NAME="font" VALUE="Arial,plain,12">
    <PARAM NAME="selectionMode" VALUE="single">
    <PARAM NAME="gridOn" VALUE="false">
    <PARAM NAME="gridColor" VALUE="#808080">
    <PARAM NAME="filterBarOn" VALUE="true">
    <PARAM NAME="columnWidth" VALUE="0,30,80,100,60,80,70,80,80,0">
    <PARAM NAME="totalRowOn" VALUE="true">
    <PARAM NAME="decimalCount_10" VALUE="0">
    <PARAM NAME="headerAlignment" VALUE="center,center,center,center,center,center,center,center,center,center">
    <PARAM NAME="columnAlignment" VALUE="left,left,left,left,center,left,right,right,right,right">
    <PARAM NAME="columnType" VALUE="number,text,text,text,text,text,text,number,number,text">
    <PARAM NAME="code" VALUE="com.ionglobal.gui.Table">
    <PARAM NAME="codeBase" VALUE="../">
    <PARAM NAME="height" VALUE="100%">
    <PARAM NAME="name" VALUE="table1">
    <PARAM NAME="width" VALUE="100%">
    <PARAM NAME="VIEWASTEXT" VALUE="">
    <PARAM NAME="mayscript" VALUE="">
    <PARAM NAME="archive" VALUE="gui.jar">
    </APPLET>
	  </TD>
 	</TR>
 	</FORM>
	</TABLE>
</body>
</html>
<%@ include file="../init_free.jsp" %>